// 状态 中带有... 的 是非稳定中的状态

// 集群类型
export const jiqunTypeFilter = value => {
  switch (value) {
    case "dev":
      return "<span>开发环境</span>";
      break;
    default:
      return value;
  }
};
// 模板类型
export const deployTypeFilter = (deployType,templateType) => {
	if(templateType&&templateType==2){
		 return "<span>组件</span>";
	}else{
		switch (deployType) {
	    case 1 :
	      return "<span>容器</span>";
	      break;
	    case 2 :
	      return "<span>裸应用</span>";
	      break;
	    default:
	      return deployType;
	  }
	}
};

// 主机状态
export const hostStatusFilter = value => {
  switch (value) {
    case "0":
    case 0:
      return "<span class='grey'>待初始化</span>";
      break;
    case "1":
    case 1:
      return "<span class='green'>正常</span>";
      break;
    case "2":
    case 2:
      return "<span class='orange'>初始化中...</span>";
      break;
    case "3":
    case 3:
      return "<span class='red'>失败</span>";
      break;
    default:
      return value;
  }
};

// 模板状态
export const tmpStatusFilter = value => {
  switch (value) {
  	case "0": case 0:
      return "<span class='grey'>已删除</span>";
      break;
    case "1": case 1:
      return "<span class='green'>正常</span>";
      break;
    case "2": case 2:
      return "<span class='orange'>构建中...</span>";
      break;
    case "3": case 3:
      return "<span class='red'>构建失败</span>";
      break;
    default:
      return value;
  }
};

// 实例状态
export const appStatusFilter = (status)=>{
	switch(status){
			case "0":case 0 : 
		  	return "<span class='orange'><i class='iconfont icon-status orange color-loading'></i>部署中...</span>"
			;break;
			case "1":case 1 : 
			return "<span class='green'><i class='iconfont icon-status green'></i>运行中</span>"
			;break;
			case "2":case 2 :  
				return "<span class='grey'><i class='iconfont icon-status grey'></i>已停止</span>"
			;break;
			case "3":case 3 :  
				return "<span class='red'><i class='iconfont icon-status red'></i>已销毁</span>"
			;break;
			case "4":case 4 :  
				return "<span class='red'><i class='iconfont icon-status red'></i>异常</span>"
			;break;
			case "5":case 5 :  
				return "<span class='grey'><i class='iconfont icon-status grey'></i>已删除</span>"
			;break;
			case "6":case 6 :  
				return "<span class='orange'><i class='iconfont icon-status orange color-loading'></i>重启中...</span>"
			;break;
			case "7":case 7 :  
				return "<span class='orange'><i class='iconfont icon-status orange color-loading'></i>启动中...</span>"
			;break;
			case "8":case 8 :  
			return "<span class='orange'><i class='iconfont icon-status orange color-loading'></i>停止中...</span>"
		  ;break;
		  case "9":case 9 :  
		    return "<span class='orange'><i class='iconfont icon-status orange color-loading'></i>销毁中...</span>"
	    ;break;
	    case "10":case 10 :  
		    return "<span class='grey'><i class='iconfont icon-status grey '></i>待部署...</span>"
	    ;break;
		default : return status ;
	}
}




// 编排 状态
export const bianpaiStatusFilter = (status,counts)=>{
	
	switch(status){
			case "0":case 0 : 
			return "<span class='orange'><i class='iconfont icon-status orange color-loading'></i>部署中...</span>"
			;break;
			case "1":case 1 :  
				if(counts){
					if(!counts.normal){
						return "<span class='red'><i class='iconfont icon-status red '></i>部署完成</span>"
					}else if(counts.normal==counts.total){
						return "<span class='green'><i class='iconfont icon-status green '></i>部署完成</span>"
					}else{
						return "<span class='orange'><i class='iconfont icon-status orange '></i>部署完成</span>"
					}
				}else{
					return "<span class='green'><i class='iconfont icon-status green '></i>部署完成</span>"
				}
			;break;
		default : return status ;
	}
}

// 编排 模板组 状态
export const bianpaiGroupStatusFilter = (status)=>{
	switch(status){
			case "0":case 0 : 
			return "<span class='grey'><i class='iconfont icon-status grey '></i>待部署...</span>"
			;break;
			case "1":case 1 :  
				return "<span class='orange'><i class='iconfont icon-status orange color-loading'></i>部署中...</span>"
			;break;
			case "2":case 2 :  
				return "<span class='green'><i class='iconfont icon-status green'></i>部分成功</span>"
			;break;
			case "3":case 3 :  
				return "<span class='green'><i class='iconfont icon-status green'></i>成功</span>"
			;break;
			case "4":case 4 :  
				return "<span class='red'><i class='iconfont icon-status red'></i>失败</span>"
			;break;
			case "5":case 5 :  
				return "<span class='grey'><i class='iconfont icon-status grey'></i>挂起...</span>"
			;break;
		default : return status ;
	}
}


// 负载均衡 状态
export const fuzaiStatusFilter = value => {
  switch (value) {
    case "0":
    case 0:
      return "<span class='blue'>启动中...</span>";
      break;
    case "1":
    case 1:
      return "<span class='green'>运行中</span>";
      break;
    case "2":
    case 2:
      return "<span class='red'>异常</span>";
      break;
    case "3":
    case 3:
      return "<span class='orange'>停止中...</span>";
      break;
    case "4":
    case 4:
      return "<span class='grey'>已停止</span>";
      break;
    case "5":
    case 5:
      return "<span class='orange'>删除中...</span>";
      break;
    case "6":
    case 6:
      return "<span class='grey'>已删除</span>";
      break;
    default:
      return value;
  }
};

// 转发配置 状态
export const zhuanfaStatusFilter = value => {
  switch (value) {
    case "0":
    case 0:
      return "<span class='green'>启用</span>";
      break;
    case "1":
    case 1:
      return "<span class='red'>不启用</span>";
      break;
    default:
      return value;
  }
};

// 告警规则状态
export const ruleStatusFilter = value => {
  switch (value) {
    case "0":
    case 0:
      return "<span class='red'>禁用</span>";
      break;
    case "1":
    case 1:
      return "<span class='green'>启用</span>";
      break;
    default:
      return value;
  }
};
//告警历史状态
export const historyStatusFilter = value => {
  switch (value) {
    case "0":
    case 0:
      return "<span class='red'>未处理</span>";
      break;
    case "1":
    case 1:
      return "<span class='green'>已处理</span>";
      break;
    case "2":
    case 2:
      return "<span class='grey'>已忽略</span>";
      break;
    default:
      return value;
  }
};
//操作日志结果
export const caozuoFilter = value =>{
  switch  (value) {
    case "0" :
    case 0 :
    return "<span class='green'>成功</span>";
    break;
    case "1" :
    case 1 :
    return "<span class='red'>失败</span>";
    break;
    default:
      return value;
  }
}


//操作日志结果
export const deployModelFilter = value =>{
  switch  (value) {
    case "0" : case 0 :
    	return "<span class=''>单机</span>";
    break;
    case "1" : case 1 :
    	return "<span class=''>主从-主</span>";
    break;
    case "2" : case 2 :
    	return "<span class=''>集群</span>";
    break;
    case "3" : case 3 :
    	return "<span class=''>伪集群</span>";
    break;
    case "4" : case 4 :
    	return "<span class=''>主从-从</span>";
    break;
    default:
      return value;
  }
}


//Vue.filter('host-status-html', function (value) {
//// 返回处理后的值
//switch(value){
//	case "1":case 1 :
//		return "正常"
//	;break;
//	default : return value  ;
//}
//})
